package cate.common.table.res.holy_pet.base;

import cate.common.table.EExcelNoteField;
import cate.common.table.EExcelRowClass;
import cate.common.table.ERow;
import easy.java.dev.note.NoteField;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 灵宠-灵宠基础 Row
 *
 * @author ShenSL
 * @since 2023/8/23 22:42
 */
@EExcelRowClass
public class HolyPetBaseRow extends ERow {
    @EExcelNoteField(fieldName = "结交任务")
    public int[] activeTasks;
    @EExcelNoteField(fieldName = "默认结交")
    public boolean autoActive;
    @EExcelNoteField(fieldName = "喜好物品")
    public int favorItem;
    @EExcelNoteField(fieldName = "喜好地点")
    public int favorPlace;

    @NoteField("任务ID列表")
    public List<Integer> taskIds;

    @Override
    public void decode() {
        super.decode();
        if (activeTasks == null) {
            taskIds = new ArrayList<>();
        } else {
            taskIds = Arrays.stream(activeTasks).filter(taskId -> taskId > 0)
                    .boxed().collect(Collectors.toList());
        }
    }
}
